<template>
	<div style="background-color: #f4fafe;">
		<!-- 顶部按钮 -->
		<div class="btn_group">
			<div>
				<el-button icon="el-icon-plus" round @click="creatCourse()" style="background-color: #03d3bd;color: white;border: none;margin-top: 1.25rem;margin-bottom: 1.25rem;margin-left: 1.25rem;">加入课程</el-button>
			</div>
			<!-- 搜索框 -->
			<div class="dataSearch">
				<!-- 输入框 -->
				<input type="text" class="ipt_val" placeholder="搜索" v-model="formData.search" />
				<!-- 放大镜 -->
				<input type="button" class="ipt_fdj" @click="getFiles" />
				<!-- 搜索按钮 -->
				<button type="button" class="ipt_search" @click="getFiles">搜索</button>
			</div>

		</div>
		<el-dialog title="加入课程" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
			<el-input v-model="input" placeholder="输入邀请码" class="input"></el-input>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible = false">取 消</el-button>
				<el-button type="primary" @click="dialogVisible = false">确 定</el-button>
			</span>
		</el-dialog>
		<div style="width: 95%;overflow: hidden;margin: 0 auto;">
			<el-row :gutter="20">
				<el-col :span="6">
					<div class="grid-content" @click="CourseCenter()">
						<div class="live-course-thumb">
							<img src="http://jy1.nbyingdong.cn/web3/picture/a3.png"/>
						</div>
						<div class="live-course-body">
							<div class="live-course-title">互联网运营全套体系</div>
							<div class="live-course-info">文案写作</div>
						</div>
					</div>
				</el-col>
				<el-col :span="6">
					<div class="grid-content" @click="CourseCenter()">
						<div class="live-course-thumb">
							<img src="http://jy1.nbyingdong.cn/web3/picture/a3.png"/>
						</div>
						<div class="live-course-body">
							<div class="live-course-title"></div>
							<div class="live-course-info"></div>
						</div>
					</div>
				</el-col>
				<el-col :span="6">
					<div class="grid-content" @click="CourseCenter()">
						<div class="live-course-thumb">
							<img src="http://jy1.nbyingdong.cn/web3/picture/a3.png"/>
						</div>
						<div class="live-course-body">
							<div class="live-course-title"></div>
							<div class="live-course-info"></div>
						</div>
					</div>
				</el-col>
				<el-col :span="6">
					<div class="grid-content" @click="CourseCenter()">
						<div class="live-course-thumb">
							<img src="http://jy1.nbyingdong.cn/web3/picture/a3.png" />
						</div>
						<div class="live-course-body">
							<div class="live-course-title"></div>
							<div class="live-course-info"></div>
						</div>
					</div>
				</el-col>
				<el-col :span="6">
					<div class="grid-content" @click="CourseCenter()">
						<div class="live-course-thumb">
							<img src="http://jy1.nbyingdong.cn/web3/picture/a3.png"/>
						</div>
						<div class="live-course-body">
							<div class="live-course-title"></div>
							<div class="live-course-info"></div>
						</div>
					</div>
				</el-col>
				<el-col :span="6">
					<div class="grid-content" @click="CourseCenter()">
						<div class="live-course-thumb">
							<img src="http://jy1.nbyingdong.cn/web3/picture/a3.png" />
						</div>
						<div class="live-course-body">
							<div class="live-course-title"></div>
							<div class="live-course-info"></div>
						</div>
					</div>
				</el-col>
				<el-col :span="6">
					<div class="grid-content" @click="CourseCenter()">
						<div class="live-course-thumb">
							<img src="http://jy1.nbyingdong.cn/web3/picture/a3.png"/>
						</div>
						<div class="live-course-body">
							<div class="live-course-title"></div>
							<div class="live-course-info"></div>
						</div>
					</div>
				</el-col>
				<el-col :span="6">
					<div class="grid-content" @click="CourseCenter()">
						<div class="live-course-thumb">
							<img src="http://jy1.nbyingdong.cn/web3/picture/a3.png" />
						</div>
						<div class="live-course-body">
							<div class="live-course-title"></div>
							<div class="live-course-info"></div>
						</div>
					</div>
				</el-col>
			</el-row>

		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				// 表单数据
				formData: {
					// 上级文件夹id，默认全部文件最上层为0
					id: 0,
					// 搜索框内容
					search: '',
					// 是否逆序
					reverse: false
				},
				dialogVisible: false,
				textarea2: '',
				input: ''
			}
		},
		methods: {
			// 获取文件列表
			async getFiles() {
				// 清空被选中文件id列表
				this.checkedList = []
				console.log('获取文件列表')
				// params参数：文件夹id、搜索的值、是否逆序
				// this.files = await axios.get('/files', { params: this.formData })
			},
			CourseCenter() {
				this.$router.push("/Coursecatalogue");
			},
			creatCourse() {
				this.dialogVisible = true;
			}
		}
	}
</script>

<style scoped="scoped" lang="scss">
	.input {
		margin-top: 1.25rem;
	}

	// 顶部按钮组
	.btn_group {
		display: flex;
		justify-content: space-between;
		// margin-top: 1.25rem;
		margin-bottom: 20px;
		// margin-left: 0.625rem;
		overflow: hidden;
		// background-color: white;


		// 搜索框
		.dataSearch {
			position: relative;
			width: 300px;
			height: 36px;
			margin-right: 1.25rem;
			margin-top: 1.25rem;
			margin-by: 1.25rem;

			// 输入框
			.ipt_val {
				position: absolute;
				left: 0;
				top: 0;
				padding: 0 14px 0 28px;
				outline: none;
				border-color: #d5d7d9;
				width: 170px;
				height: 34px;
				font-size: 14px;
				color: #181e33;
				border: 1px solid #e5e5e5;
				background: #f5f6f7;
				border-radius: 40px;

				&:hover {
					border-color: #03d3bd;
				}

				&:focus {
					border-color: #03d3bd;
				}
			}

			// 放大镜
			.ipt_fdj {
				position: absolute;
				// right: 14px;
				left: 8px;
				top: 8px;
				border: none;
				width: 18px;
				height: 18px;
				background-color: pink;
				background: url(/images/search_ico_new.png);
				background-size: 18px;

				&:hover {
					cursor: pointer;
					background-position: 0 -22px;
				}
			}

			// 搜索按钮
			.ipt_search {
				// width: 40px;
				position: absolute;
				right: 0;
				top: 0;
				padding: 0 22px;
				border: none;
				height: 36px;
				border-radius: 17px;
				background-color: #03d3bd;
				color: #fff;


				&:hover {
					cursor: pointer;
					color: #03d3bd;
				}
			}
		}
	}

	.grid-content {
		width: 98%;
		height: 273px;
		display: flex;
		cursor: pointer;
		flex-direction: column;
		border-radius: 8px;
		margin-left: 1%;
		margin-right: 1%;
		margin-top: 1.25rem;
	}

	.live-course-thumb img{
		width: 100%;
		height: 100%;
		border-radius: 8px 8px 0 0;
		transition: all .5s;
	}

	.live-course-thumb {
		width: 100%;
		height: 198px;
		border-radius: 8px 8px 0 0;
		overflow: hidden;
	}

	.live-course-body {
		box-sizing: border-box;
		width: 100%;
		height: 75px;
		background-color: #fff;
		border-radius: 0 0 8px 8px;
		padding: 15px 15px 15px 10px;
	}

	.live-course-title {
		width: 100%;
		height: 16px;
		float: left;
		font-size: 16px;
		font-weight: 600;
		color: #333;
		line-height: 16px;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		margin-bottom: 9px;
	}

	.live-course-info {
		width: 100%;
		height: 20px;
		float: left;
		display: flex;
		align-items: center;
		color: #cfcfcf;
	}
</style>
